package reesoft.idgenerator;

import reesoft.common.code.ErrorCode;

/**
 * Created by reesoft on 2017-08-28
 */
public class IdGenerateException extends Exception
{
    private int code;

    public IdGenerateException(int code, String message)
    {
        super(message);
        this.code = code;
    }

    public IdGenerateException(String message)
    {
        super(message);
        code = ErrorCode.SERVER_INTERNAL_ERROR.getCode();
    }

    public IdGenerateException(ErrorCode errorCode)
    {
        super(errorCode.getDesc());
        code = errorCode.getCode();
    }

    public int getCode()
    {
        return code;
    }

    public void setCode(int code)
    {
        this.code = code;
    }
}
